
const getDefaultState = () => {
  return {
    routes: [],
    allRoutes: []
  }
}

const state = getDefaultState()

const mutations = {
  RESET_STATE: (state) => {
    Object.assign(state, getDefaultState())
  },
  SET_TOKEN: (state, token) => {
    state.token = token
  },
  SET_NAME: (state, name) => {
    state.name = name
  },
  SET_AVATAR: (state, avatar) => {
    state.avatar = avatar
  },
  add_routes(state, k) {
    state.allRoutes = k
  }
  // ADD_Routes(state, arr) {
  //   // state.routes = [...arr,
  //   //   { path: '*', redirect: '/404', hidden: true }
  //   // ]
  // }

}

const actions = {
  // user login
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
